//
//  SCCarAddImageModel.m
//  Shuaiche
//
//  Created by dangshuai on 2019/4/23.
//  Copyright © 2019 zzs. All rights reserved.
//

#import "SCCarAddImageModel.h"

@implementation SCCarAddImageModel
+ (nullable NSArray<NSString *> *)modelPropertyBlacklist {
    return @[@"imagesArray",@"isFold",@"isUpload"];
}

- (NSMutableArray <SCCarAddImageItemModel *>*)imagesArray {
    if (!_imagesArray) {
        _imagesArray = [NSMutableArray arrayWithCapacity:10];
    }
    return _imagesArray;
}

- (NSMutableArray <SCCarAddImageItemModel *>*)showImagesArray {
    if (!_showImagesArray) {
        _showImagesArray = [NSMutableArray arrayWithCapacity:0];
    }
    return _showImagesArray;
}

- (void)addImageSelectItem {
    [self.imagesArray addObject: [SCCarAddImageItemModel addModel]];
    _imagesCount = _imagesCount + 1;
}



@end


@implementation SCCarAddImageItemModel

+ (instancetype)addModel {
    SCCarAddImageItemModel *model = [[SCCarAddImageItemModel alloc] init];
    model.isAddButton = YES;
    model.image = [UIImage imageNamed:@"car_img_add"];
    model.positionInfo = @{@"display": @"其它"};
    model.positionId = 999;
    return model;
}

- (void)addSelecteImage:(UIImage *)image {
    self.image = image;
    self.fillImage = YES;
}

- (void)addSelecteImagePath:(NSString *)imagePath {
    self.imageUrlPath = imagePath;
    self.fillImage = YES;
}

- (void)addSelecteImage:(UIImage *)image withPath:(NSString *)imagePath {
    self.image = image;
    self.imageUrlPath = imagePath;
    
    self.fillImage = image || imagePath.length;
}

- (void)removeSelecteImage {
    self.image = nil;
    self.imageUrlPath = nil;
    self.fillImage = NO;
}

@end
